API Documentation
Public Member Functions | List of all members
nkScripts::Script Class Referencefinal

Holds all information for a script. More...

Inheritance diagram for nkScripts::Script:
nkExport::Exportable

Public Member Functions

 Script ()
 
 ~Script ()
 
INTERPRETER getScriptType () const
 
nkMemory::StringView getName () const
 
nkMemory::StringView getSources () const
 
const CompilationResultgetLastCompilationResult () const
 
void setScriptFor (INTERPRETER interpretType)
 
void setName (const nkMemory::StringView &name)
 
void setSources (const nkMemory::StringView &sources)
 
bool load ()
 
void unload ()
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable ()
 
virtual ~Exportable ()
 

Detailed Description

Holds all information for a script.

The holder is also responsible for script compilation and usage within an environment.

Constructor & Destructor Documentation

◆ Script()

nkScripts::Script::Script ( )

Constructor.

◆ ~Script()

nkScripts::Script::~Script ( )

Destructor.

Member Function Documentation

◆ getScriptType()

INTERPRETER nkScripts::Script::getScriptType ( ) const
Returns
The current interpreter used for the script.

◆ getName()

nkMemory::StringView nkScripts::Script::getName ( ) const
Returns
The name attached to the script.

◆ getSources()

nkMemory::StringView nkScripts::Script::getSources ( ) const
Returns
The sources attached to the script.

◆ getLastCompilationResult()

const CompilationResult& nkScripts::Script::getLastCompilationResult ( ) const
Returns
The last compilation attempt result.

◆ setScriptFor()

void nkScripts::Script::setScriptFor ( INTERPRETER  interpretType)

Sets the interpreter this script should target.

Parameters
interpretTypeThe type of interpreter the script should compile for.

◆ setName()

void nkScripts::Script::setName ( const nkMemory::StringView name)

Sets the name of the script.

Parameters
nameThe name to assign.
Remarks
In theory, should only be called by the ScriptManager to update the script when needed.

◆ setSources()

void nkScripts::Script::setSources ( const nkMemory::StringView sources)

Sets the sources the script should compile from.

Parameters
sourcesThe sources to assign.

◆ load()

bool nkScripts::Script::load ( )

Loads the script. This triggers recompilation and prepares it for intepretation within the Environment.

Returns
If the loading went well (true) or not (false). If an error occurred, a call to getLastCompilationResult() can be made to check what went wrong.

◆ unload()

void nkScripts::Script::unload ( )

Unloads and free all resources linked to compilation within the script.

◆ exportClassToTree()

virtual void nkScripts::Script::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Basic exporting capabilities.

Parameters
rootNodeThe root of the tree to export into.

Implements nkExport::Exportable.

◆ importClassFromTree()

virtual void nkScripts::Script::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Basic importing capabilities.

Parameters
rootNodeThe root of the trree to import from.

Implements nkExport::Exportable.


The documentation for this class was generated from the following file: